var sub = document.getElementById("submit");
var Mytype = document.getElementById("type");
var Mydirection = document.getElementById("direction");
var Mysurr = document.getElementById("surr");
var Mydecorate = document.getElementById("decorate");

function shoeTips(spanId, tips) {
    var span = document.getElementById(spanId);
    span.innerHTML = tips;
}
/**
 * 校验ID合法性
 */
function checkID() {
    var MyID = document.getElementById('id');
    var hint = document.getElementById("id-hint");
    if (MyID.value.length < 2) {
        hint.innerHTML = "ID太短";
        return false;
    } else {
        hint.innerHTML = "ID合格";
        return true;
        console.log("MyID:" + MyID);
    }
}

function IDhide() {
    var hint = document.getElementById("id-hint");
    hint.innerHTML = "";
}
/**
 * 校验房屋地址合法性
 */
function addresshint() {
    var Myadress = document.getElementById('address');
    var hint = document.getElementById("address-hint");
    if (Myadress.value.length < 5) {
        hint.innerHTML = "房屋地址不够详细";
        return false;
    } else {
        hint.innerHTML = "房屋地址合格";
        return true;
    }
}

function address_hide() {
    var hint = document.getElementById("address-hint");
    hint.innerHTML = "";
}
/**
 * 校验楼层合法性
 */
function floorhint() {
    var Myfloor = document.getElementById('floor');
    var hint = document.getElementById("floor-hint");
    if (Myfloor.value.length < 0) {
        hint.innerHTML = "楼层输入不正确";
        return false;
    } else {
        hint.innerHTML = "楼层合格";
        return true;
    }
}

function floor_hide() {
    var hint = document.getElementById("floor-hint");
    hint.innerHTML = "";
}
/**
 * 校验建筑面积合法性
 */
function prohint() {
    var Mypro = document.getElementById('proportion');
    var hint = document.getElementById("pro-hint");
    if (Mypro.value.length < 1) {
        hint.innerHTML = "建筑面积格式不正确";
        return false;
    } else {
        hint.innerHTML = " ";
        return true;
    }
}

function pro_hide() {
    var hint = document.getElementById("pro-hint");
    hint.innerHTML = "";
}
/**
 * 校验租金合法性
 */
function Rentmoneyhint() {
    var Myrentmoney = document.getElementById('Rentmoney');
    var hint = document.getElementById("rentmoney-hint");
    if (Myrentmoney.value.length < 0) {
        hint.innerHTML = "请输入正确的租金";
        return false;
    } else {
        hint.innerHTML = " ";
        return true;
    }
}

function Rent_hide() {
    var hint = document.getElementById("rentmoney-hint");
    hint.innerHTML = "";
}
/**
 * 校验区域合法性
 */
function areahint() {
    var Myarea = document.getElementById("area");
    var hint = document.getElementById("area-hint");
    if (Myarea.value.length < 3) {
        hint.innerHTML = "区域输入不清晰";
        return false;
    } else {
        hint.innerHTML = " ";
        return true;
    }

}

function area_hide() {
    var hint = document.getElementById("area-hint");
    hint.innerHTML = " ";
}
/**
 * 校验发布人合法性
 */
function issuerhint() {
    var Issuer = document.getElementById("issuer");
    var hint = document.getElementById("issuer-hint");
    if (Issuer.value.length < 2 || Issuer.value.length > 6) {
        hint.innerHTML = "发布人信息不合格";
        return false;
    } else {
        hint.innerHTML = "发布人信息合格 ";
        return true;
    }
}

function Issuer_hide() {
    var hint = document.getElementById("issuer-hint");
    hint.innerHTML = "";
}

function checkForm() {
    var flag = checkID() && addresshint() && floorhint() && prohint() && Rentmoneyhint() && areahint() && issuerhint();
    return flag;
}